package com.orhon.smartcampus.modules.schoolaffairs.fetcher;


import com.orhon.smartcampus.modules.schoolaffairs.mutation.*;
import graphql.schema.idl.RuntimeWiring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class SchoolNewNoticeFetchersLoader {

    //新闻
    @Autowired
    SchoolNewsFetcher schoolNewsFetcher;

    @Autowired
    SchoolNewssFetcher schoolNewssFetcher;

    @Autowired
    AddSchoolNewsMutation addSchoolNewsMutation;

    @Autowired
    DeleteSchoolNewsMutation deleteSchoolNewsMutation;

    //公告
    @Autowired
    SchoolNoticeFetcher schoolNoticeFetcher;

    @Autowired
    SchoolNoticesFetcher schoolNoticesFetcher;

    @Autowired
    DeleteSchoolNoticeMutation deleteSchoolNoticeMutation;

    @Autowired
    AddSchoolNoticeMutation addSchoolNoticeMutation;

    //意见箱
    @Autowired
    SchoolOpinionsFetcher schoolOpinionsFetcher;

    @Autowired
    SchoolOpinionFetcher schoolOpinionFetcher;

    @Autowired
    DeleteSchoolOpinionMutation deleteSchoolOpinionMutation;

    @Autowired
    AddSchoolOpinionMutation addSchoolOpinionMutation;

    //轮播图/名人名言
    @Autowired
    SchoolChartSayingFetcher schoolChartSayingFetcher;

    @Autowired
    SchoolChartSayingsFetcher schoolChartSayingsFetcher;

    @Autowired
    AddSchoolChartSayingMutation addSchoolChartSayingMutation;

    @Autowired
    DeleteSchoolChartSayingMutation deleteSchoolChartSayingMutation;

    //考勤公示
    @Autowired
    AddSchoolFormulaMutation addSchoolFormulaMutation;

    @Autowired
    DeleteSchoolFormulaMutation deleteSchoolFormulaMutation;

    public void LoadFetchers(RuntimeWiring.Builder builder){
        builder.type("Query" , t->t.dataFetcher("SchoolNews" , schoolNewsFetcher));
        builder.type("Query" , t->t.dataFetcher("SchoolNewss" , schoolNewssFetcher));
        builder.type("Mutation" , t->t.dataFetcher("addSchoolNews" , addSchoolNewsMutation));
        builder.type("Mutation" , t->t.dataFetcher("deleteSchoolNews" , deleteSchoolNewsMutation));

        builder.type("Query" , t->t.dataFetcher("SchoolNotice" , schoolNoticeFetcher));
        builder.type("Query" , t->t.dataFetcher("SchoolNotices" , schoolNoticesFetcher));
        builder.type("Mutation" , t->t.dataFetcher("addSchoolNotice" , addSchoolNoticeMutation));
        builder.type("Mutation" , t->t.dataFetcher("deleteSchoolNotice" , deleteSchoolNoticeMutation));

        builder.type("Query" , t->t.dataFetcher("SchoolOpinion" , schoolOpinionFetcher));
        builder.type("Query" , t->t.dataFetcher("SchoolOpinions" , schoolOpinionsFetcher));
        builder.type("Mutation" , t->t.dataFetcher("addSchoolOpinion" , addSchoolOpinionMutation));
        builder.type("Mutation" , t->t.dataFetcher("deleteSchoolOpinion" , deleteSchoolOpinionMutation));

        builder.type("Query" , t->t.dataFetcher("SchoolChartSaying" , schoolChartSayingFetcher));
        builder.type("Query" , t->t.dataFetcher("SchoolChartSayings" , schoolChartSayingsFetcher));
        builder.type("Mutation" , t->t.dataFetcher("addSchoolChartSaying" , addSchoolChartSayingMutation));
        builder.type("Mutation" , t->t.dataFetcher("deleteSchoolChartSaying" , deleteSchoolChartSayingMutation));

        builder.type("Mutation" , t->t.dataFetcher("addSchoolFormula" , addSchoolFormulaMutation));
        builder.type("Mutation" , t->t.dataFetcher("deleteSchoolFormula" , deleteSchoolFormulaMutation));

    }

}
